﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit.aspx.cs" Inherits="JumbotCms.Modules.Version.Admin._edit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>译文编辑</title>
<link type="text/css" rel="stylesheet" href="../../../admin/otherpage/styles/common.css" />
<script type="text/javascript" src="../../../_data/SysConfig.js"></script>
<script type="text/javascript" src="../../../_libs/jquery-min.js"></script>
<script type="text/javascript" src="../../../scripts/jumbotcms.js?v4"></script>
<link type="text/css" rel="stylesheet" href="../../../style/global.css" />
<link type="text/css" rel="stylesheet" href="../../../_libs/jquery.formvalidator/style.css" />
<script src="../../../_libs/jquery.formvalidator.js" type="text/javascript"></script>

<link type="text/css" rel="stylesheet" href="../../../_libs/jquery.colorpicker/style.css" />
<script type="text/javascript" src="../../../_libs/jquery.colorpicker.js"></script>
<script type="text/javascript">
var ccid = joinValue('ccid');
$(document).ready(function(){
	$("#txtTColor").attachColorPicker();
	var color = $("#txtTColor").getValue();
	if(color!="")
		$("#txtTitle").css("color",color);
	$("#txtTColor").change(function() {
		var color2 = $("#txtTColor").getValue();
		$("#txtTitle").css("color","#000");
		$("#txtTitle").css("color",color2);
	});
	if("<%=sourceid%>" != "0")
	{
		$.ajax({
			type:		"get",
			dataType:	"json",
			data:		"sourceid=<%=sourceid%>&time="+(new Date().getTime()),
			url:		"../adminsource/ajax.aspx?oper=ajaxGetSimple"+ccid,
			error:		function(XmlHttpRequest,textStatus, errorThrown){if(XmlHttpRequest.responseText!=""){alert(XmlHttpRequest.responseText);}},
			success:	function(data){
				//数据绑定
				if(data.result == "1"){
					$("#txtTitle").val(data.table[0].title);
					$("#txtTitle2").val(data.table[0].title2);
					$("#ddlArmsId").attr("value",data.table[0].armsid);
					$("#txtAuthor").val(data.table[0].author);
					$("#txtAuthor2").val(data.table[0].author2);
					$("#txtUserId").val(data.table[0].userid);
					$("#txtSourceFrom").val(data.table[0].sourcefrom);
					$("#txtSourceFrom2").val(data.table[0].sourcefrom2);
					$("#txtSourceFromUrl2").val(data.table[0].sourcefromurl2);
					$("#txtAuthorSummary").val(data.table[0].authorsummary.replace(/(<br\/> )/g,'\r'));
					$("#txtAuthorSummary2").val(data.table[0].authorsummary2.replace(/(<br\/> )/g,'\r'));
					$("#txtTags").val(data.table[0].tags);
				    $("#txtSummary").val(data.table[0].summary.replace(/(<br\/> )/g,'\r'));
					$("#txtCountries").val(data.table[0].countries);
					$("#txtTranslator").val(data.table[0].translator);
					$("#txtWordCount").val(data.table[0].wordcount);
					$("#txtWordCount2").val(data.table[0].wordcount2);
					$("#txtDownUrl1").val(data.table[0].downurl1);
					$("#txtDownUrl2").val(data.table[0].downurl2);
				}
			}
		});
	}
	$.formValidator.initConfig({onError:function(msg){}});
	$("#txtTitle").formValidator({tipid:"tipTitle",onshow:"请输入译文标题，单引号之类的将自动过滤",onfocus:"至少输入6个字符",oncorrect:""}).InputValidator({min:6,onerror:"至少输入6个字符,请确认"})
		.AjaxValidator({
		type : "get",
		data:		"id=<%=id%>" + ccid,
		url:		"ajax.aspx?oper=checkname&time="+(new Date().getTime()),
		datatype : "json",
		success : function(d){	
			if(d.result == "1")
				return true;
			else
				return false;
		},
		buttons: $("#btnSave"),
		error: function(){alert("服务器没有返回数据，可能服务器忙，请重试");},
		onerror : "该标题已经存在",
		onwait : "正在校验标题的合法性，请稍候..."
	}).DefaultPassed();
	$("#txtAuthorSummary").formValidator({tipid:"tipAuthorSummary",onshow:"500个汉字以内",onfocus:"500个汉字以内",oncorrect:""}).InputValidator({max:1000,onerror:"500个汉字以内"});
	$("#txtAuthorSummary2").formValidator({tipid:"tipAuthorSummary2",onshow:"1000个字符以内",onfocus:"1000个字符",oncorrect:""}).InputValidator({max:1000,onerror:"1000个字符以内"});
	$("#txtTranslator").formValidator({tipid:"tipTranslator",onshow:"每个人用[]括起来,例如：[姓名1][姓名2]",onfocus:"每个人用[]括起来,例如：[姓名1][姓名2]",oncorrect:""}).RegexValidator({regexp:"^([\[]{1}[a-zA-Z0-9\u4E00-\u9FA5\uF900-\uFA2D]+[\]]{1})+$",onerror:"每个人用[]括起来,例如：[姓名1][姓名2]"});
	$("#txtWordCount").formValidator({tipid:"tipWordCount",onshow:"请填写非0数字",onfocus:"请填写非0数字",oncorrect:""}).RegexValidator({regexp:"^\([1-9]{1}[0-9]*)$",onerror:"请填写非0数字"});
	$("#txtPoints").formValidator({tipid:"tipPoints",onshow:"请填写数字",onfocus:"请填写数字",oncorrect:""}).RegexValidator({regexp:"^\([0-9]+)$",onerror:"请填写数字"});
	$("#txtDownUrl1").formValidator({tipid:"tipDownUrl1",onshow:"请上传打包文件",onfocus:"请上传打包文件",oncorrect:""}).InputValidator({min:1,onerror:"必须填写"});
});
//插入预览附件地址
function AttachmentSelected(path,elementid)
{
	$("#"+elementid).val(path);
}
//插入上传文章
function AttachmentOperater(path,type,size){
	if($("#chkDown1").attr("checked")==true)//说明点中的是译文上传
		$("#txtDownUrl1").val(path);
	else
	    $("#txtDownUrl2").val(path);
}
    </script>
</head>
<body>
<form id="form1" runat="server" onsubmit="return jQuery.formValidator.PageIsValid('1')">
	<table class="formtable">
		<tr>
			<th> 标题(中文) </th>
			<td><asp:TextBox ID="txtAddDate" runat="server" Visible="false" CssClass="ipt"></asp:TextBox>
				<asp:TextBox ID="txtTitle" runat="server" MaxLength="150" Width="97%" CssClass="ipt"></asp:TextBox>
				<div class="ValidatorTip" id="tipTitle" style="width:250px"> </div>
				<br />
				<img alt="标题颜色" src="../../../admin/otherpage/images/color.gif" width="21" height="21"
                    align="absbottom" />
				<asp:TextBox ID="txtTColor" runat="server" Width="80px" CssClass="ipt"></asp:TextBox>
			</td>
		</tr>
		<tr>
			<th> 原文来源(中文) </th>
			<td><asp:TextBox ID="txtSourceFrom" runat="server" Width="97%" CssClass="ipt"></asp:TextBox>
			</td>
		</tr>
		<tr>
			<th> 原作者(中文) </th>
			<td><asp:TextBox ID="txtAuthor" runat="server" MaxLength="20" Width="97%" CssClass="ipt"></asp:TextBox>
				<span style="display: none;">
				<asp:TextBox ID="txtEditor" runat="server" CssClass="ipt"></asp:TextBox>
				<asp:TextBox ID="txtUserId" runat="server" CssClass="ipt">0</asp:TextBox>
				</span> </td>
		</tr>
		<tr>
			<th> 作者简介(中文) </th>
			<td><asp:TextBox ID="txtAuthorSummary" runat="server" Height="120px" TextMode="MultiLine"
                    Width="97%"></asp:TextBox>
				<div class="ValidatorTip" id="tipAuthorSummary" style="width:250px"> </div></td>
		</tr>
		<tr>
			<th> 主题词(中文) </th>
			<td><span id="msgTags" onmouseover="JumbotCms.Hint.show(this,0,0,'','多个标签之间请用&quot;,&quot;分割','40','up','0');"
                    onmouseout="JumbotCms.Hint.hide();">
				<asp:TextBox ID="txtTags" runat="server" MaxLength="150" Width="97%" CssClass="ipt" onblur="FormatListValue(this.id);"></asp:TextBox>
				</span> </td>
		</tr>
		<tr>
			<th> 文中涉及国家地区(中文) </th>
			<td><span id="msgCountries" onmouseover="JumbotCms.Hint.show(this,0,0,'','多个国家之间请用&quot;,&quot;分割','40','up','0');"
                    onmouseout="JumbotCms.Hint.hide();">
				<asp:TextBox ID="txtCountries" runat="server" MaxLength="200" Width="97%" CssClass="ipt" onblur="FormatListValue(this.id);"></asp:TextBox>
				</span> </td>
		</tr>
		<tr>
			<th> <% = site.WriterItem %>
			</th>
			<td><asp:TextBox ID="txtTranslator" runat="server" MaxLength="40" Width="200px" CssClass="ipt"></asp:TextBox>
				<div class="ValidatorTip" id="tipTranslator" style="width:250px"> </div></td>
		</tr>
		<tr>
			<th> 译文字数 </th>
			<td><asp:TextBox ID="txtWordCount" runat="server" MaxLength="10" Width="60px" CssClass="ipt">0</asp:TextBox>
				<div class="ValidatorTip" id="tipWordCount" style="width:250px"> </div></td>
		</tr>
		<tr>
			<th> 下载需点数 </th>
			<td><asp:TextBox ID="txtPoints" runat="server" MaxLength="3" Width="30px" CssClass="ipt">0</asp:TextBox>
				<div class="ValidatorTip" id="tipPoints" style="width:250px"> </div></td>
		</tr>
		<tr>
			<th> 知远导读(中文) </th>
			<td><asp:TextBox ID="txtSummary" runat="server" Height="120px" TextMode="MultiLine" Width="97%"></asp:TextBox>
			</td>
		</tr>
		<tr>
			<th> 标题(外文) </th>
			<td><asp:TextBox ID="txtTitle2" runat="server" MaxLength="150" Width="97%" CssClass="ipt"></asp:TextBox>
			</td>
		</tr>
		<tr>
			<th> 原文来源(外文) </th>
			<td><asp:TextBox ID="txtSourceFrom2" runat="server" MaxLength="100" Width="97%" CssClass="ipt"></asp:TextBox>
			</td>
		</tr>
		<tr>
			<th> 原文网址 </th>
			<td><asp:TextBox ID="txtSourceFromUrl2" runat="server" MaxLength="200" Width="97%" CssClass="ipt"></asp:TextBox>
			</td>
		</tr>
		<tr>
			<th> 原作者(外文) </th>
			<td><asp:TextBox ID="txtAuthor2" runat="server" MaxLength="100" Width="97%" CssClass="ipt"></asp:TextBox>
			</td>
		</tr>
		<tr>
			<th> 作者简介(外文) </th>
			<td><asp:TextBox ID="txtAuthorSummary2" runat="server" Height="120px" TextMode="MultiLine"
                    Width="97%"></asp:TextBox>
				<div class="ValidatorTip" id="tipAuthorSummary2" style="width:250px"> </div></td>
		</tr>
		<tr>
			<th> 军种/兵种 </th>
			<td><asp:DropDownList ID="ddlArmsId" runat="server"> </asp:DropDownList>
			</td>
		</tr>
		<tr>
			<th> 所属栏目 </th>
			<td><asp:DropDownList ID="ddlClassId" runat="server"> </asp:DropDownList>
			</td>
		</tr>
		<tr>
			<th> 最低浏览权限 </th>
			<td><asp:DropDownList ID="ddlReadGroup" runat="server"> </asp:DropDownList>
			(此功能在静态生成的频道无效)
			</td>
		</tr>
		<tr>
			<th> 缩略图 </th>
			<td><asp:TextBox ID="txtImg" runat="server" MaxLength="230" Width="97%" CssClass="ipt"></asp:TextBox>
				<a href="javascript:void(0);" onclick="WinFullOpen('<%=site.Dir %>admin/cut2thumb/upload.aspx?ccid=<%=ChannelId %>');">
                <img src="../../../admin/otherpage/images/createthumb.png" align="absmiddle" style="border-width:0px;" />
				</a> </td>
		</tr>
		<tr>
			<th> 推荐 </th>
			<td><asp:RadioButtonList ID="rbtnContentTop" runat="server" RepeatColumns="2">
					<Items>
						<asp:ListItem Value="0" Selected="True">否</asp:ListItem>
						<asp:ListItem Value="1">是</asp:ListItem>
					</Items>
				</asp:RadioButtonList>
			</td>
		</tr>
		<tr style="display: none;">
			<th> 原文字数 </th>
			<td><asp:TextBox ID="txtWordCount2" runat="server" MaxLength="10" Width="60px" CssClass="ipt">0</asp:TextBox>
				<div class="ValidatorTip" id="tipWordCount2" style="width:250px"> </div></td>
		</tr>
		<tr>
			<th> 文章上传 </th>
			<td><iframe id="frm_upload" src="../../../admin/attachment/index.aspx?ccid=<%=ChannelId %>"
                    width="100%" height="30" scrolling="no" frameborder="0"></iframe>
				<br />
				<input id="chkDown1" name="chkDown" type="radio" value="1" checked="checked" />
				译文
				<input id="chkDown2" name="chkDown" type="radio" value="2" />
				原文 </td>
		</tr>
		<tr>
			<th> 译文地址 </th>
			<td><asp:TextBox ID="txtDownUrl1" runat="server" Width="500px" CssClass="ipt"></asp:TextBox><a href="javascript:void(0);" onclick="WindowOpen('<%=site.Dir %>admin/attachment/preview.aspx?ccid=<%=ChannelId %>&ElementID=txtDownUrl1',600,400);"><img src="../../../admin/otherpage/images/preview.gif" align="absmiddle" style="border-width:0px;" /></a>
				<div class="ValidatorTip" id="tipDownUrl1" style="width:250px"> </div></td>
		</tr>
		<tr>
			<th> 原文地址 </th>
			<td><asp:TextBox ID="txtDownUrl2" runat="server" Width="500px" CssClass="ipt"></asp:TextBox><a href="javascript:void(0);" onclick="WindowOpen('<%=site.Dir %>admin/attachment/preview.aspx?ccid=<%=ChannelId %>&ElementID=txtDownUrl2',600,400);"><img src="../../../admin/otherpage/images/preview.gif" align="absmiddle" style="border-width:0px;" /></a>
			</td>
		</tr>
	</table>
	<div class="buttonok">
		<asp:CheckBox ID="chkIsEdit" runat="server" Text="立即发布" Visible="false" />
		<asp:Button ID="btnSave" runat="server" Text="确定" CssClass="btnsubmit" OnClick="btnSave_Click" />
		<input id="btnReset" type="button" value="取消" class="btncancel" onclick="parent.JumbotCms.Popup.hide();" />
	</div>
</form>
<script>jcms$$SetDialogTitle();</script>
</body>
</html>
